/*
Copyright SecureKey Technologies Inc. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
*/

package iam

type AttributeRequest struct {
	Name     string
	Optional bool
}

// RegistrationRequest 注册请求
type RegistrationRequest struct {
	Name           string
	Type           string
	MaxEnrollments int
	Affiliation    string
	Attributes     []Attribute
	CAName         string
	Secret         string
}

type Attribute struct {
	Name  string
	Value string
	ECert bool
}

// RevocationRequest  吊销请求
type RevocationRequest struct {
	Name   string
	Serial string
	AKI    string
	Reason string
	CAName string
	GenCRL bool
}

type RevocationResponse struct {
	RevokedCerts []RevokedCert
	CRL          []byte
}

type RevokedCert struct {
	Serial string
	AKI    string
}

type IdentityRequest struct {
	ID             string
	Affiliation    string
	Attributes     []Attribute
	Type           string
	MaxEnrollments int
	Secret         string
	CAName         string
}

type IdentityResponse struct {
	ID             string
	Affiliation    string
	Attributes     []Attribute
	Type           string
	MaxEnrollments int
	Secret         string
	CAName         string
}

type RemoveIdentityRequest struct {
	ID     string
	Force  bool
	CAName string
}

type AffiliationRequest struct {
	Name   string
	Force  bool
	CAName string
}

type ModifyAffiliationRequest struct {
	AffiliationRequest
	NewName string
}

type AffiliationResponse struct {
	AffiliationInfo
	CAName string
}

type AffiliationInfo struct {
	Name         string
	Affiliations []AffiliationInfo
	Identities   []IdentityInfo
}

type IdentityInfo struct {
	ID             string
	Type           string
	Affiliation    string
	Attributes     []Attribute
	MaxEnrollments int
}

type GetCAInfoResponse struct {
	CAName                    string
	CAChain                   []byte
	IssuerPublicKey           []byte
	IssuerRevocationPublicKey []byte
	Version                   string
}

type CSRInfo struct {
	CN    string
	Hosts []string
}
